package org.example.config;

import dev.langchain4j.memory.ChatMemory;
import dev.langchain4j.memory.chat.MessageWindowChatMemory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 聊天内存配置类
 * 用于配置和管理聊天对话的内存存储
 */
@Configuration
public class MemoryChatConfig {

    /**
     * 创建聊天内存Bean
     * 配置消息窗口聊天内存，限制最大消息数量为10条
     * @return ChatMemory 聊天内存实例
     */
    @Bean
    ChatMemory chatMemory(){
        return MessageWindowChatMemory.withMaxMessages(10);
    }
}

